package com.xjoyt.pay.master.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xjoyt.pay.controllers.AbstractController;
import com.xjoyt.pay.dto.ExecuteResult;
import com.xjoyt.pay.dto.PageParam;
import com.xjoyt.pay.dto.PageResult;
import com.xjoyt.pay.master.interfaces.CompanyRateContract;
import com.xjoyt.pay.master.params.CompanyPageParam;
import com.xjoyt.pay.master.po.CompanyRate;
import com.xjoyt.pay.master.services.CompanyRateService;
import com.xjoyt.pay.master.vo.CompanyRateMap;

@RestController
@RequestMapping("companyRate")
public class CompanyRateController extends AbstractController implements CompanyRateContract {

	@Autowired
	private CompanyRateService service;

	@Override
	public List<CompanyRate> findAllByCompanyId(@PathVariable("companyId") String companyId) {
		return service.findAllByCompanyId(companyId);
	}

	@Override
	public ExecuteResult<CompanyRate> save(CompanyRate param) {
		return service.save(param);
	}

	@Override
	public ExecuteResult<?> remove(@PathVariable("id") String id) {
		return service.delete(id);
	}

	@Override
	public PageResult<CompanyRateMap> loadPageRate(@RequestBody PageParam<CompanyPageParam> param) {
		return service.loadPageRate(param);
	}

	@Override
	public ExecuteResult<?> saveRate(@RequestBody CompanyRateMap param) {
		return service.saveRate(param);
	}
}
